<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
	<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title><spring:message code="system"/>-<spring:message code="username"/>登录</title>
	<link rel="stylesheet" href="/base/layui/css/layui.css">
	<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
	<script src="/base/layui/layui.js"></script>
	<link rel="stylesheet" href="/ncpsycss/login.css">
	<link id="layuicss-layer" rel="stylesheet" href="http://localhost:8080/base/layui/css/modules/layer/default/layer.css?v=3.1.1" media="all">
	<link rel="icon" href="/base/images/favicon.ico" type="image/x-icon"/>
	<link href="/base/css/back/default.css" rel="stylesheet" type="text/css" />
	<!--必要样式-->
	<link href="/base/css/back/styles.css" rel="stylesheet" type="text/css" />
	<link href="/base/css/back/demo.css" rel="stylesheet" type="text/css" />
	<link href="/base/css/back/loaders.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class='login'>
	<div class="language-switcher">
		<a href="?lang=zh">中文</a> | <a href="?lang=en">English</a>
	</div>
	<div class='login_title'>
		<span><spring:message code="adminLogin"/></span>

	</div>
	<div class='login_fields'>
		<form class="layui-form" id="loginForm" >
			<div class="layui-form-item">
				<div class='login_fields__user'>
					<div class='icon'>

						<img alt="" src='/base/images/user_icon_copy.png'>
					</div>
					<input name="zh" id="username" class="username" placeholder='<spring:message code="username"/>' maxlength="16"  type='text' autofocus autocomplete="off"/>
					<div class='validation'>
						<img alt="" src='/base/images/tick.png'>
					</div>
				</div>
				<div class='login_fields__password'>
					<div class='icon'>
						<img alt="" src='/base/images/lock_icon_copy.png'>
					</div>
					<input name="mm" id="password" class="passwordNumder"  placeholder='<spring:message code="password"/>' maxlength="16" type='text' autocomplete="off">
					<div class='validation'>
						<img alt="" src='/base/images/tick.png'>
					</div>
				</div>
				<div class='login_fields__submit'>
					<input type='button' lay-submit lay-filter="login" id="loginBtn" value='<spring:message code="login"/>'>
				</div>
			</div>

		</form>

<%--		<div class='login_fields__password'>--%>
<%--			<div class='icon'>--%>
<%--				<img alt="" src='/base/images/key.png'>--%>
<%--			</div>--%>
<%--			<input name="code" id="code"  placeholder='验证码' maxlength="4"  class="ValidateNum" type='text' autocomplete="off">--%>
<%--			<div class='validation' style="opacity: 1; right: -5px;top: -3px;">--%>
<%--				<canvas style="position: relative;top: 5px;cursor: pointer" class="J_codeimg" id="myCanvas" onclick="code()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas>--%>
<%--			</div>--%>
<%--		</div>--%>

	</div>
	<div class='success'>
	</div>
	<div class='disclaimer'>
		<p>欢迎登录农产品后台管理平台</p>
	</div>
</div>
<div class='authent'>
	<div class="loader" style="height: 60px;width: 60px;margin-left: 28px;margin-top: 40px">
		<div class="loader-inner ball-clip-rotate-multiple">
			<div></div>
			<div></div>
			<div></div>
		</div>
	</div>
	<p>认证中...</p>
</div>
<div class="OverWindows"></div>
<script src="/base/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/base/js/jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src='/base/js/jquery/stopExecutionOnTimeout.js?t=1'></script>
<script src="/base/js/layer-3.5.1/layer.js" type="text/javascript"></script>
<script src="/base/js/jquery/Particleground.js" type="text/javascript"></script>
<script src="/base/js/jquery/jquery.mockjax.js" type="text/javascript"></script>
<script src="/base/js/myJs/login.js" type="text/javascript"></script>
</body>
<script>
	//粒子背景特效
	$('body').particleground({
		dotColor: '#E8DFE8',
		lineColor: '#1b3273'
	});
	layui.use(['form', 'layer'], function() {
		var form = layui.form,
				layer = layui.layer;

		form.on('submit(login)', function(data) {
			console.log(data.field);
			var index = layer.load();
			$.ajax({
				url: '/base/handle/admin/login',
				type: 'post',
				contentType: "application/json;charset=UTF-8",
				data: JSON.stringify(data.field),
				dataType: 'json',
				timeout: 20000,
				success: function(response) {
					console.log(response);
					layer.close(index);
					layer.msg("登录成功");
					//localStorage.setItem("qyid", response.qyid);
					//将返回的企业信息储存在localStorage
					for(var prop in response) {
						localStorage.setItem("" + prop, response[prop]);
					}
					window.location.href="/base/admin/home";
				},
				error: function(response) {
					console.log(response);
					layer.close(index);
					layer.msg("请求出错，请重试!");
				}
			});
			return false;
		})
	})

</script>
</html>
